#include <iostream>
#include <string>
#include <vector>

using namespace std;

// course
class Course
{
public:
    string name;
    int credit;

    Course(string n, int c) : name(n), credit(c) {}
};

// student
class Student
{
public:
    string name;
    int age;
    vector<Course *> courses;

    Student(string n, int a) : name(n), age(a) {}

    void enrollCourse(Course *course)
    {
        courses.push_back(course);
    }
};

// teacher
class Teacher
{
public:
    string name;
    vector<Course *> courses;

    Teacher(string n) : name(n) {}

    void addCourse(Course *course)
    {
        courses.push_back(course);
    }
};

int main()
{

    // create course
    Course math("math", 3);
    Course physics("physics", 10);
    Course chinese("chinese", 20);

    // create teacher
    Teacher teacher("张飞");

    teacher.addCourse(&math);
    teacher.addCourse(&chinese);

    // create student
    Student student1("张三", 20);
    Student student2("李四", 20);
    Student student3("王五", 22);

    student1.enrollCourse(&math);
    student2.enrollCourse(&physics);
    student3.enrollCourse(&chinese);

    cout << student1.name << "选的课：" << student1.courses.size() << endl;
    for (Course *course : student1.courses)
    {
        cout << course->name << " " << course->credit << endl;
    }

    cout << student2.name << "选的课：" << student2.courses.size() << endl;
    for (Course *course : student2.courses)
    {
        cout << course->name << " " << course->credit << endl;
    }

    cout << student3.name << "选的课：" << student3.courses.size() << endl;
    for (Course *course : student3.courses)
    {
        cout << course->name << " " << course->credit << endl;
    }
}